package com.chenfan.process.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

public enum ApprovalMessageTypeEnum {

    APPROVAL_NOTIFY("SPL_SPTZ", "SPL_SPTZ_EOP","SPL_SPTZ_MCN","默认消息模板-审批通知"),
    APPROVAL_REFUSE("SPL_SPBHTZ", "SPL_SPBHTZ_EOP","SPL_SPBHTZ_MCN","默认消息模板-审批驳回通知"),
    APPROVAL_PASS("SPL_SPTGTZ", "SPL_SPTGTZ_EOP","SPL_SPTGTZ_MCN","默认消息模板-审批通过通知"),
    APPROVAL_REMIND("SPL_CBTZ", "SPL_CBTZ_EOP","SPL_CBTZ_MCN","默认消息模板-催办通知"),
    APPROVAL_OVERDUE("SPL_CQTX", "SPL_CQTX_EOP","SPL_CQTX_MCN","默认消息模板-超期提醒通知"),
    APPROVAL_CC("SPL_CSTZ", "SPL_CSTZ_EOP","SPL_CSTZ_MCN","默认消息模板-抄送通知"),
    APPROVAL_TRANSFER("SPL_SPZRTZ", "SPL_SPZRTZ_EOP","SPL_SPZRTZ_MCN","默认消息模板-审批转让通知"),
    BUSINESS("BUSINESS", null,null,"业务类型"),
    ;

    @Getter
    private String type;

    /**
     * 给eop用
     */
    @Getter
    private String eopCode;

    /**
     * 给mcn用
     */
    @Getter
    private String mcnCode;
    @Getter
    private String message;

    ApprovalMessageTypeEnum(String type, String eopCode, String mcnCode, String message) {
        this.type = type;
        this.eopCode = eopCode;
        this.mcnCode = mcnCode;
        this.message = message;
    }

    public static boolean defaultValue(String value) {
        for(ApprovalMessageTypeEnum item: values() ) {
            if (StringUtils.equalsAny(value, item.eopCode, item.mcnCode)) {
                return true;
            }
        }
        return false;
    }

    /**
     * 是否是MCN
     * @param belongSystem
     * @return
     */
    public static Boolean isMcn(String belongSystem) {
        return StringUtils.equalsAnyIgnoreCase(belongSystem, "MCN", "火龙果");
    }
}
